package v2.chapter9.jaas2;

import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;

public class MyLoginTest {

	public static void main(String[] args) throws LoginException {
		LoginContext lc=new LoginContext("Sample",new MyCallbackHandler());
		try {
			lc.login();
			Subject subject=lc.getSubject();
			System.out.println(subject);
			System.out.println("Authentication succeeded!");
		} catch (Exception e) {
			 System.err.println("Authentication failed:" + e.getMessage());
		}
	}

}
